package Comprter;

public class Board {
	private String name;

	public Board(String name) {
		this.name = name;
	}

	Usb[] usbs = new Usb[3];
	Pci[] pcis = new Pci[5];

	public void panduan(Object a) {
		if (a instanceof Usb) {
			Usb b1 = (Usb) a;

			for (int i = 0; i < usbs.length; i++) {
				if (usbs[i] == null) {
					usbs[i] = b1;
					return;
				}
			}
		} else if (a instanceof Pci) {
			Pci b2 = (Pci) a;

			for (int i = 0; i < pcis.length; i++) {
				if (pcis[i] == null) {
					pcis[i] = b2;
					return;
				}
			}
		}
	}

	public void power() {
		System.out.println(this.name + "");
		for (int i = 0; i < usbs.length; i++) {
			if (usbs[i] != null) {
				usbs[i].service();
			}
		}
		for (int i = 0; i < pcis.length; i++) {
			if (pcis[i] != null) {
				pcis[i].start();

			}
		}
	}

}
